<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_PilotProjetanalyse extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdPILOTPROJETANALYSE;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_PILOTPROJECTIdPILOTPROJECT;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_PILOTLISTCLIENTSIdPILOTLISTCLIENTS;

    /**
     * Database var type varchar(255)
     *
     * @var string
     */
    protected $_IdPILOTMODELANALYSE;


    /**
     * Parent relation fk_PILOT_PROJETANALYSE_PILOT_PROJECT1
     *
     * @var Application_Model_PilotProject
     */
    protected $_PilotProject;

    /**
     * Parent relation fk_PILOT_PROJETANALYSE_PILOT_LISTCLIENTS1
     *
     * @var Application_Model_PilotListclients
     */
    protected $_PilotListclients;

    /**
     * Parent relation fk_PILOT_PROJETANALYSE_PILOT_MODELANALYSE1
     *
     * @var Application_Model_PilotModelanalyse
     */
    protected $_PilotModelanalyse;


    /**
     * Dependent relation fk_PILOT_DATAJSON_PILOT_PROJETANALYSE1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotDatajson
     */
    protected $_PilotDatajson;

    /**
     * Dependent relation fk_PILOT_LOTDATA_PILOT_PROJETANALYSE1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_PilotLotdata
     */
    protected $_PilotLotdata;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idPILOT_PROJETANALYSE'=>'IdPILOTPROJETANALYSE',
            'PILOT_PROJECT_idPILOT_PROJECT'=>'PILOTPROJECTIdPILOTPROJECT',
            'PILOT_LISTCLIENTS_idPILOT_LISTCLIENTS'=>'PILOTLISTCLIENTSIdPILOTLISTCLIENTS',
            'idPILOT_MODELANALYSE'=>'IdPILOTMODELANALYSE',
        ));

        $this->setParentList(array(
            'FkPILOTPROJETANALYSEPILOTPROJECT1'=> array(
                    'property' => 'PilotProject',
                    'table_name' => 'PilotProject',
                ),
            'FkPILOTPROJETANALYSEPILOTLISTCLIENTS1'=> array(
                    'property' => 'PilotListclients',
                    'table_name' => 'PilotListclients',
                ),
            'FkPILOTPROJETANALYSEPILOTMODELANALYSE1'=> array(
                    'property' => 'PilotModelanalyse',
                    'table_name' => 'PilotModelanalyse',
                ),
        ));

        $this->setDependentList(array(
            'FkPILOTDATAJSONPILOTPROJETANALYSE1' => array(
                    'property' => 'PilotDatajson',
                    'table_name' => 'PilotDatajson',
                ),
            'FkPILOTLOTDATAPILOTPROJETANALYSE1' => array(
                    'property' => 'PilotLotdata',
                    'table_name' => 'PilotLotdata',
                ),
        ));
    }

    /**
     * Sets column idPILOT_PROJETANALYSE
     *
     * @param int $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setIdPILOTPROJETANALYSE($data)
    {
        $this->_IdPILOTPROJETANALYSE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_PROJETANALYSE
     *
     * @return int
     */
    public function getIdPILOTPROJETANALYSE()
    {
        return $this->_IdPILOTPROJETANALYSE;
    }

    /**
     * Sets column PILOT_PROJECT_idPILOT_PROJECT
     *
     * @param int $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPILOTPROJECTIdPILOTPROJECT($data)
    {
        $this->_PILOTPROJECTIdPILOTPROJECT = $data;
        return $this;
    }

    /**
     * Gets column PILOT_PROJECT_idPILOT_PROJECT
     *
     * @return int
     */
    public function getPILOTPROJECTIdPILOTPROJECT()
    {
        return $this->_PILOTPROJECTIdPILOTPROJECT;
    }

    /**
     * Sets column PILOT_LISTCLIENTS_idPILOT_LISTCLIENTS
     *
     * @param int $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPILOTLISTCLIENTSIdPILOTLISTCLIENTS($data)
    {
        $this->_PILOTLISTCLIENTSIdPILOTLISTCLIENTS = $data;
        return $this;
    }

    /**
     * Gets column PILOT_LISTCLIENTS_idPILOT_LISTCLIENTS
     *
     * @return int
     */
    public function getPILOTLISTCLIENTSIdPILOTLISTCLIENTS()
    {
        return $this->_PILOTLISTCLIENTSIdPILOTLISTCLIENTS;
    }

    /**
     * Sets column idPILOT_MODELANALYSE
     *
     * @param string $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setIdPILOTMODELANALYSE($data)
    {
        $this->_IdPILOTMODELANALYSE = $data;
        return $this;
    }

    /**
     * Gets column idPILOT_MODELANALYSE
     *
     * @return string
     */
    public function getIdPILOTMODELANALYSE()
    {
        return $this->_IdPILOTMODELANALYSE;
    }

    /**
     * Sets parent relation PILOTPROJECTIdPILOTPROJECT
     *
     * @param Application_Model_PilotProject $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPilotProject(Application_Model_PilotProject $data)
    {
        $this->_PilotProject = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_PROJECT'];
        }

        $this->setPILOTPROJECTIdPILOTPROJECT($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTPROJECTIdPILOTPROJECT
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotProject
     */
    public function getPilotProject($load = true)
    {
        if ($this->_PilotProject === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTPROJETANALYSEPILOTPROJECT1', $this);
        }

        return $this->_PilotProject;
    }

    /**
     * Sets parent relation PILOTLISTCLIENTSIdPILOTLISTCLIENTS
     *
     * @param Application_Model_PilotListclients $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPilotListclients(Application_Model_PilotListclients $data)
    {
        $this->_PilotListclients = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_LISTCLIENTS'];
        }

        $this->setPILOTLISTCLIENTSIdPILOTLISTCLIENTS($primary_key);

        return $this;
    }

    /**
     * Gets parent PILOTLISTCLIENTSIdPILOTLISTCLIENTS
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotListclients
     */
    public function getPilotListclients($load = true)
    {
        if ($this->_PilotListclients === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTPROJETANALYSEPILOTLISTCLIENTS1', $this);
        }

        return $this->_PilotListclients;
    }

    /**
     * Sets parent relation IdPILOTMODELANALYSE
     *
     * @param Application_Model_PilotModelanalyse $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPilotModelanalyse(Application_Model_PilotModelanalyse $data)
    {
        $this->_PilotModelanalyse = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idPILOT_MODELANALYSE'];
        }

        $this->setIdPILOTMODELANALYSE($primary_key);

        return $this;
    }

    /**
     * Gets parent IdPILOTMODELANALYSE
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_PilotModelanalyse
     */
    public function getPilotModelanalyse($load = true)
    {
        if ($this->_PilotModelanalyse === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTPROJETANALYSEPILOTMODELANALYSE1', $this);
        }

        return $this->_PilotModelanalyse;
    }

    /**
     * Sets dependent relations fk_PILOT_DATAJSON_PILOT_PROJETANALYSE1
     *
     * @param array $data An array of Application_Model_PilotDatajson
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPilotDatajson(array $data)
    {
        $this->_PilotDatajson = array();

        foreach ($data as $object) {
            $this->addPilotDatajson($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_DATAJSON_PILOT_PROJETANALYSE1
     *
     * @param Application_Model_PilotDatajson $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function addPilotDatajson(Application_Model_PilotDatajson $data)
    {
        $this->_PilotDatajson[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_DATAJSON_PILOT_PROJETANALYSE1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotDatajson
     */
    public function getPilotDatajson($load = true)
    {
        if ($this->_PilotDatajson === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTDATAJSONPILOTPROJETANALYSE1', $this);
        }

        return $this->_PilotDatajson;
    }

    /**
     * Sets dependent relations fk_PILOT_LOTDATA_PILOT_PROJETANALYSE1
     *
     * @param array $data An array of Application_Model_PilotLotdata
     * @return Application_Model_PilotProjetanalyse
     */
    public function setPilotLotdata(array $data)
    {
        $this->_PilotLotdata = array();

        foreach ($data as $object) {
            $this->addPilotLotdata($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_PILOT_LOTDATA_PILOT_PROJETANALYSE1
     *
     * @param Application_Model_PilotLotdata $data
     * @return Application_Model_PilotProjetanalyse
     */
    public function addPilotLotdata(Application_Model_PilotLotdata $data)
    {
        $this->_PilotLotdata[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_PILOT_LOTDATA_PILOT_PROJETANALYSE1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_PilotLotdata
     */
    public function getPilotLotdata($load = true)
    {
        if ($this->_PilotLotdata === null && $load) {
            $this->getMapper()->loadRelated('FkPILOTLOTDATAPILOTPROJETANALYSE1', $this);
        }

        return $this->_PilotLotdata;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_PilotProjetanalyse
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_PilotProjetanalyse());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_PilotProjetanalyse::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdPILOTPROJETANALYSE() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idPILOT_PROJETANALYSE = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdPILOTPROJETANALYSE()));
    }
}
